﻿
using System;

namespace GNUGo.Net.CLI.CliControls {
    public class CliPrompt : CliLabel {
        public string ReadLine() {
            ResetConsole();
            string line = Console.ReadLine();
            Invalidate();
            ResetConsole();
            return line;
        }

        public override void Invalidate() {
            base.Invalidate();
            ResetConsole();
        }

        private void ResetConsole() {
            Console.ForegroundColor = Forecolor;
            Console.BackgroundColor = Backcolor;
            Console.CursorLeft = Left + Text.Length;
            Console.CursorTop = Top;
        }
    }
}
